#!/bin/bash
# Common Configuration file for all qmail daemons
# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/conf-common,v 1.2 2013/05/27 00:45:52 robbat2 Exp $

# Qmail User IDS to run daemons as
QMAILDUID=$(id -u qmaild)
NOFILESGID=$(id -g qmaild)
QMAILLUID=$(id -u qmaill)

# Qmail Control Dir (this is actually set in /etc/env.d/99qmail)
#QMAIL_CONTROLDIR=/var/qmail/control

# Host and port to listen on
# We listen on the IPv4 local ip by default
TCPSERVER_HOST=0.0.0.0
TCPSERVER_PORT=${SERVICE}

# you do not need to specify -x, -c, -u or -g in this variable as those are
# added later
TCPSERVER_OPTS="-p -v -R"

#  This tells tcpserver where to file the rules cdb file
[[ -d /etc/tcprules.d/ ]] && \
	TCPSERVER_RULESCDB=/etc/tcprules.d/tcp.qmail-${SERVICE}.cdb
[[ ! -f "${TCPSERVER_RULESCDB}" ]] && \
	TCPSERVER_RULESCDB=/etc/tcp.${SERVICE}.cdb

# we limit data and stack segments to 32mbytes, you may need to raise this if
# you are using a filter in QMAILQUEUE. 
# Per bug #403893 amd64 needs a higher limit.
SOFTLIMIT_OPTS="-m 32000000"

# We don't have anything to set QMAILQUEUE to at the moment, so we leave it
# alone. Generally it is best to add this in your appropriate (usually SMTP)
# cdb files at /etc/tcprules.d/tcp.qmail-*.cdb instead of on a global basis, as
# otherwise outgoing mail will be checked (because qmail-queue is used for most
# parts of qmail). You can also enable this per-server by just placing it into
# the other configuration files by placing the line there instead. Please note
# that the export part is important.
#export QMAILQUEUE=""

# tcpserver maximum concurrency, defaults to 40 in tcpserver
# this controls the maximum number of incoming connections that it will accept
if [[ -e ${QMAIL_CONTROLDIR}/concurrencyincoming ]]
then
	MAXCONN=$(head -n 1 ${QMAIL_CONTROLDIR}/concurrencyincoming)
else
	MAXCONN=40
fi

# logging directives
LOG_OPTS="t" # 't' is for timestamp
LOG_MAXSIZE=2500000 # defalts to '99999' if empty
LOG_MAXCOUNT=10 # defaults to '10' if empty

# build LOG_OPTS from this
[[ -n "${LOG_MAXSIZE}" ]] && \
	LOG_OPTS="${LOG_OPTS} s${LOG_MAXSIZE}"
[[ -n "${LOG_MAXCOUNT}" ]] && \
	LOG_OPTS="${LOG_OPTS} n${LOG_MAXCOUNT}"

# directory to log to
LOG_DEST=/var/log/qmail/qmail-${SERVICE}d

# BIG FAT WARNING:
# If you disable this by uncommenting it you will turn _off_ the configuration
# sanity check do so at your own risk!
#QMAIL_DISABLE_SANITY_CHECK=1
